﻿#include "getapprunningstateres.h"

GetAppRunningStateRes::GetAppRunningStateRes() : BaseMsg(MSG_TYPE_GET_APP_RUNNING_STATE_RES)
{

}

GetAppRunningStateRes::~GetAppRunningStateRes()
{

}

int GetAppRunningStateRes::decodeParametersFromTlv(TLV *tlv)
{
    if(tlv->tag == GetAppRunningStateResTag_apps)
    {
        AppRunningInfo app;
        app.decodeParametersFromBuffer((byte *)tlv->buffer,tlv->length);
        apps.push_back(app);
    }

    return f_success;
}

int GetAppRunningStateRes::encodeParametersIntoTlvs(list<TLV *> &tlvs)
{
    foreach (AppRunningInfo app, apps) {
        tlvs.push_back(createTlvByTLVEncodedObject(GetAppRunningStateResTag_apps, &app));
    }

    return f_success;
}
